<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Insert title here</title>
<link type="text/css" rel="stylesheet" href="css/style.css">
<script type="text/javascript">
	function doit(flag, id) {
		if (flag == "del") {
			if (confirm("确认删除吗？") != true)
				return;
		}
	}
</script>
</head>
<body>


	<div class="menu">

		<table>
			<tbody>
				<tr>
					<td><form method="post" action="userAdmin">
							用户名称：<input name="username" class="input-text" type="text">&nbsp;&nbsp;&nbsp;&nbsp;
							<input value="查 询" type="submit">
						</form></td>
				</tr>
			</tbody>
		</table>
	</div>
	<div class="main">

		<div class="optitle clearfix">
		<c:if test="${sessionScope.users.role==1}">
			<em><input value="添加数据" class="input-button"
				onclick="window.location='userAdd.jsp'" type="button"> </em></c:if>
			<div class="title">用户管理&gt;&gt;</div>
		</div>
		<div class="content">
			<table class="list">
				<tbody>
					<tr>
						<td width="80"><div class="STYLE1" align="center">用户名称</div>
						</td>
						<td width="100"><div class="STYLE1" align="center">性别</div></td>
						<td width="100"><div class="STYLE1" align="center">年龄</div></td>
						<td width="150"><div class="STYLE1" align="center">电话</div></td>
						<td width="150"><div class="STYLE1" align="center">地址</div></td>
						<td width="150"><div class="STYLE1" align="center">权限</div></td>
						<td width="150"><div class="STYLE1" align="center">操作</div></td>
					</tr>

					<c:forEach var="u" items="${list}">
						<tr>
							<td><span class="STYLE1">${u.username}</span></td>
							<td><span class="STYLE1">${u.sex}</span></td>
							<td><span class="STYLE1">${u.age}</span></td>
							<td><span class="STYLE1">${u.phone}</span></td>
							<td><span class="STYLE1">${u.address}</span></td>
							<td><span class="STYLE1"> <c:if test="${u.role==0}">普工员工</c:if>
									<c:if test="${u.role==1}">经理</c:if> </span></td>
							<td><c:if
									test="${sessionScope.users.role==1 || sessionScope.users.username==u.username}">
									<a href="userUpdate?username=${u.username}">修改</a>
								</c:if>
								<c:if test="${sessionScope.users.role==1}">
									<a href="userDel?username=${u.username}" onclick="return confirm('确定要删除么？')">删除</a>
								</c:if>	
							</td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
			<div class="page">
				<a href="userAdmin">首页</a> <a
					href="userAdmin?pageIndex=${pageIndex-1}">上一页</a> <a
					href="userAdmin?pageIndex=${pageIndex+1}">下一页</a> <a
					href="userAdmin?pageIndex=${pageCount}">尾页</a>
			</div>
		</div>
	</div>
</body>
</html>
